/*
 *	Paired Processors
 *
 *	Author:	S.C.Merrall
 *
 *	File:	proc_pair.m
 *
 *	Contents:	PP_left_right_proc
 *			PP_active_set
 *			PP_other_way
 *
 *	Description:	Three variables which specify the current state of
 *			paired processor system. One indicates which direction
 *			data should be transferred to move it to the `other'
 *			set.
 *
 *	Change History:
 *
 *	Date   Name Comment
 *    -------- ---- -------
 *    17:01:92 SCM  Created
 *
 */

#include <mpl.h>
#include "proc_pair.h"

/*  These variables are the proc pair equivalents of the mpl globals
 *  without the prefix
 */

int PP_nproc;
plural int PP_iproc;

int PP_nxproc;
plural int PP_ixproc;

int PP_nyproc;
plural int PP_iyproc;

/*  These variables specify what the current processor set is and which
 *  way data should move. The starting configuration is:
 *
 *  Even numbered PEs are active;
 *                      PP_active_set = (1, 0, 1, 0, 1, 0, 1, 0 ... )
 *
 *  That is the left member of each pair is active;
 *                      PP_left_right_proc = PP_LEFT;
 *
 *  The variable PP_which_way specifies which direction the `other' set is.
 *  That is, is it left or right;
 *                      PP_which_way = (PP_RIGHT, PP_LEFT, PP_RIGHT, PP_LEFT ..
 *                                   = (1, 0, 1, 0 ...)
 */
 
int PP_left_right_proc;
plural int PP_active_set;
plural int PP_which_way;

#ifdef __STDC__

void init_proc_pair( void )

#else

void init_proc_pair( )

#endif

{
   PP_nproc = nproc/2;
   PP_iproc = iproc/2;
   PP_nxproc = nxproc/2;
   PP_ixproc = ixproc/2;
   PP_nyproc = nyproc;
   PP_iyproc = iyproc;
   PP_left_right_proc = PP_LEFT;
   PP_active_set = (!(iproc%2));
   PP_which_way = (PP_active_set);
	
/*   PP_switch();  */

 }

